home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 957 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.iddis.com!jarnot
  2. From: jarnot@iddis.com (Kevin J. Jarnot)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What wrong with this code ??????
  5. Date: 09 Jan 1996 19:57:44 GMT
  6. Organization: IDD Information Services
  7. Message-ID: <JARNOT.96Jan9145744@box10.dstar.iddis.com>
  8. References: <4bjl81$qiu@wumpus.cc.uow.edu.au>
  9. Reply-To: jarnot@iddis.com
  10. NNTP-Posting-Host: box10.dstar.iddis.com
  11. To: tp86@wumpus.cc.uow.edu.au (PAOPENG THEERADECH)
  12. In-reply-to: tp86@wumpus.cc.uow.edu.au's message of 25 Dec 1995 00:40:17 +1100
  13.  
  14. >>>>> "PAOPENG" == PAOPENG THEERADECH <tp86@wumpus.cc.uow.edu.au> writes:
  15.  
  16.     PAOPENG> #include <stdio.h>
  17.     PAOPENG> /* copy input to output */
  18.     PAOPENG> main()
  19.     PAOPENG> {
  20.     PAOPENG>     int c;
  21.     PAOPENG>     
  22.     PAOPENG>     printf("\nPlease Enter the character: ");
  23.     PAOPENG>     c =getchar();
  24.     PAOPENG>     while (c != EOF)
  25.     PAOPENG>     {
  26.     PAOPENG>         putchar(c);
  27.     PAOPENG>         c = getchar;
  28.                                  ^^^^
  29.     PAOPENG>     }
  30.     PAOPENG> }
  31.  
  32.     PAOPENG> Do anyone here know what wrong with this code?
  33.  
  34.  
  35.  
  36.  
  37. I'm not sure if it was your problem, but you forgot the parens
  38. afer getchar.
  39.  
  40.  
  41. You should have an interesting value stored in c!  BTW, this is
  42. valid C code, although you'll get a warning about mixing pointers
  43. and integers.
  44.  
  45.  
  46.  
  47. Kevin
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. -- 
  57. Kevin J. Jarnot - Senior Software Engineer | mailto:jarnot@iddis.com 
  58. IDD Information Services  Waltham, MA      | http://www-cs.canisius.edu/~jarnot
  59.